package common;

import java.io.Serializable;

import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;
import org.springframework.transaction.annotation.Transactional;

import common.BaseEntity;

import org.beetl.sql.core.mapper.*;


@ImportResource(locations = "classpath*:/applicationContext.xml")
public  class BaseService<E extends BaseEntity, M extends BaseMapper<E>>{

	
	public  static BlockingQueue<String> sqlLog = new LinkedBlockingQueue<String>();// 对数据库做修改时，保存insert，update和delete语句，用来推送到相应的游戏分区
	protected M getMapper;
	

	@Transactional()
	public List<E> queryEntityList() {
		List<E> list = getMapper.all();
		return list;
	}

	@Transactional()
	public void updateEntityById(E e) {
		getMapper.updateTemplateById(e);
	}
	
	@Transactional()
	public void deleteUserById(E e)  {
		getMapper.deleteById(e);
	}
}
